variable string forward=w
variable string backward=s
variable string strafeleft=a
variable string straferight=d
variable string endbot=f11
variable int mytarget=0

function main()
{
	Turbo 1000
	Echo "${Script.ExecuteAtom[CheckAggro]} : ${Actor[${Script.ExecuteAtom[CheckAggro]}].Name}"
	Target "${Script.ExecuteAtom[CheckAggro]}"
}

function atexit()
{
	EQ2Echo Ending Wanderbot!
	press -release ${forward}
	press -release ${backward}
	press -release ${strafeleft}
	press -release ${straferight}
}

atom(script):int CheckAggro()
{
	declare a uint local 1
	EQ2:CreateCustomActorArray[byDist,5]
	while ${a:Inc} <= ${EQ2.CustomActorArraySize}
	{
		if ${Actor[${CustomActor[${a}].ID}].Target.ID} == ${Me.ID}
		{
			RETURN ${CustomActor[${a}].ID}
		}
	}
	RETURN 0
}